#!/bin/bash
#auto add user and bind to docker group
for name in `cat userinfo.txt`
do

  useradd  $name > /dev/null
  if [ $? -eq 0 ]; then
    echo $name "add ok"
    #auto add uder to docker group
    usermod -aG docker $name
  else
    echo $name "add faild ##################"
  fi

  echo "Spark123" | passwd --stdin $name > /dev/null
  if [ $? -eq 0 ]; then
    echo $name "passwd change ok"
  else
    echo $name "passwd change faild ################"
  fi

done
